<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!doctype html>
 <html lang="zh-CN">
 <head>
   <meta charset="UTF-8">
   <%@ include file="/share/systemInclude.jsp" %>
   
   <script type="text/javascript">
   	var assignDialog = null;
      $(function(){  
        $(".list_table").colResizable({
          liveDrag:true,
          gripInnerHtml:"<div class='grip'></div>", 
          draggingClass:"dragging", 
          minWidth:30
        }); 
        
        //表单提交前 验证 表单
        $("#updateForm").Validform({
			btnSubmit : "#btn_sub",
			tiptype : 3,
			beforeCheck:function(curform){
				 
			 },
			 beforeSubmit:function(data){
				 
			 }
		});
		
		$('#scrollPath').click();
        
      });
      
      function assignObj(th){
      	var objId = $(th).val();
      	var objType = $('#scrollType').val();
      	doAssign('选择店铺',objType,objId);
      }
      
      function doAssign(title,value,objId){
		assignDialog = art.dialog({
			title:title,
			fixed: true,
		    padding: 0,
		    lock: true,
		    width: 800,
		    height: 430,
		    content: 'url:${root}/control/scroll/scrollImageController/assignObjList.do?scrollType='+value+'&scrollObjId='+objId,
		    button:[{
		    	name:'确定',
		    	callback:function(){
		    		var data = this.iframe.contentWindow.getData();
		    		if(value == '1'){
		    			return setObjId("店铺",data,value);
					}else if(value == '2'){
						return setObjId("案例",data,value);
					}
		    	}
		    }],
		    close: function(event, ui) { 
		    	/* //如果关闭不进行选择操作,还原原先选择的类型
		    	var data = this.iframe.contentWindow.getData();
		    	//旧的类型值
		    	var oldValue = $('#oldPicType').val();
		    	if(value != oldValue){
					var options = document.getElementById("picType").options;
					for(var i = 0;i < options.length; i++){
						if(options[i].value == oldValue){
							options[i].selected = "selected";
						}
					}
		    	} */
		    } 
		});
	}
	//根据选择的类型设置类型主键
	function setObjId(name,data,value){
		if(data == "-1"){
   			artDalog("提示" ,"选择的"+name+"不存在",null);
   			return false;
   		}else if(data == "-2"){
   			artDalog("提示" ,"请选择"+name,null);
   			return false;
   		}else{
   			//拆分对象主键和城市主键
   			var datas = data.split("&");
   			//设置对象的主键值
   			$('#objId').val(datas[0]);
   			//设置城市主键值
   			$('#cityId').val(datas[1]);
   			//设置完主键值,聚焦激活验证事件
   			$('#objId').focus();
   			
   			//$('#oldPicType').val(value);
   			return true;
   		}
	}
   </script>
   <title>Document</title>
 </head>
 <body>
  <div class="container">
   <div id="forms" class="">
        <div class="box">
          <div class="box_border">
            <div class="box_top">
            	<b class="pl15">
            		<c:if test="${operateStatus == 'sysAdd' }">
						添加滚动图：
					</c:if>
					<c:if test="${operateStatus == 'sysEdit' }">
						编辑滚动图：
					</c:if>
            	</b>
            </div>
            <div class="box_center">
              <form id="updateForm" action="${root }/control/scroll/scrollImageController/${operateStatus}.do" class="jqtransform" method="post">
               <input type="hidden" name="scrollId" value="${scroll.scrollId }" class="input-text lh30" size="40"/>
               <table class="form_table pt15 pb15" width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                  <td class="td_right"><span class="need">*</span>scrollName：</td>
                  <td class=""> 
                    <input type="text" maxlength="50" name="scrollName" value="${fn:escapeXml(scroll.scrollName)}" class="input-text lh30" size="40" dataType="*1-50" ajaxurl="${root}/supply/globalController/findCheck.do?tabName=scroll_image&json=${scroll.scrollName }&msg=滚动图标题&status=3&statusName=scrollStatus&statusRelation=2">
                  </td>
                </tr>
                <tr>
                  <td class="td_right"><span class="need">*</span>scrollImage：</td>
                  <td class="">
                  	<span id="scrollPathShow">
						<c:if test="${not empty scroll.scrollPath}">
							<img id="scrollPathImage" src="${imageService }${scroll.scrollPath}" alt="" style="width: 200px;height: 200px;" />
						</c:if>
					</span>
					<input type="hidden" name="oldScrollPath" value="${scroll.scrollPath}" />
					<input type="hidden" id="scrollPathValue" name="scrollPath" value="${scroll.scrollPath}" dataType="*"/>
					<input type="button" name="button" class="btn btn82 btn_add" id="scrollPath" value="Image" onclick="uploadImage('scrollPath','scrollPathShow','scrollPathValue','${imageService}');" />
                  </td>
                </tr>
                 <tr>
                  <td class="td_right"><span class="need">*</span>scrollObjId：</td>
                  <td class="">
                  	<c:if test="${operateStatus == 'sysEdit' }">
                  		<input type="hidden" id="scrollType" name="scrollType" value="${fn:escapeXml(scroll.scrollType)}" class="input-text lh30" size="40" dataType="*" >
                  	</c:if>
                  	<c:if test="${operateStatus == 'sysAdd' }">
                  		<input type="hidden" id="scrollType" name="scrollType" value="1" class="input-text lh30" size="40" dataType="*" >
                  	</c:if>
                  	<input type="hidden" id="cityId" name="cityId" value="${fn:escapeXml(scroll.scrollObjId)}" class="input-text lh30" size="40" readonly="readonly" dataType="*" onclick="assignObj(this);" >
                    <input type="text" id="objId" name="scrollObjId" value="${fn:escapeXml(scroll.scrollObjId)}" class="input-text lh30" size="40" readonly="readonly" dataType="*" onclick="assignObj(this);" >
                  </td>
                 </tr>
                 <tr>
                   <td class="td_right">&nbsp;</td>
                   <td class="">
                     <input id="btn_sub" type="button" name="button" class="btn btn82 btn_save2" value="保存" >
                    <input type="button" name="button" class="btn btn82 btn_res" value="返回" onclick="location.href='javascript:history.go(-1)'"> 
                   </td>
                 </tr>
               </table>
               </form>
            </div>
          </div>
        </div>
     </div> 
  </div> 
 </body>
 </html>
  